//
// Created by Administrator on 2024/3/11.
//
#include<bits/stdc++.h>

using namespace std;
using ll = long long;
#define endl '\n'

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    vector<int> a;
    int q;
    cin >> q;
    while (q--) {
        int op;
        cin >> op;
        if (op == 0) {
            int x;
            cin >> x;
            a.push_back(x);
        } else if (op == 1) {
            int x;
            cin >> x;
            if (a.size() > x)
                cout << a[x] << endl;
        } else if (op == 2) {
            if (a.size() > 0) {
                a.pop_back();
            }
        }


    }


    return 0;
}

